package com.test;

import com.qcloud.vod.VodUploadClient;
import com.qcloud.vod.model.VodUploadRequest;
import com.qcloud.vod.model.VodUploadResponse;
import lombok.extern.slf4j.Slf4j;


/**
 * @author hh
 * @date 2021/3/5 14:21
 */
@Slf4j
public class TencentOnDemandUtils {

    private  static final String secretId="AKIDBl7LdikR13tPsQqocR2PwS3RxGJ7NXSI";
    private  static final String secretKey="ob9UdZkqPxGk2wEMEvUHxhmfXIQK3YzP";


    public static VodUploadClient getClient(){
        VodUploadClient client = new VodUploadClient(secretId, secretKey);
        return client;
    }
    
    public static boolean upload(){
        VodUploadClient client = getClient();
        VodUploadRequest request = new VodUploadRequest();
        request.setMediaFilePath("C:\\Users\\91941\\Desktop\\aa\\test.mp4");
        request.setCoverFilePath("C:\\Users\\91941\\Desktop\\aa\\test.jpg");
        try {
            VodUploadResponse response = client.upload("ap-guangzhou", request);
            log.info("Upload FileId = {}", response.getFileId());
        } catch (Exception e) {
            // 业务方进行异常处理
            log.error("Upload Err", e);
        }
        return true;
    }

}
